#ifndef __WIZ_BASE_EXCEPTION_HPP__SHANHAOBO_19800429__
#define __WIZ_BASE_EXCEPTION_HPP__SHANHAOBO_19800429__

#include <exception>
#include <stdexcept>

#include "./Type/WizBaseType.hpp"
#include "./Macro/WizBaseMacroUtils.hpp"

namespace Wiz
{
    namespace Exception
    {
        ////////////////////////////////////////////////////////////////////////
        template<class E>
        ::Wiz::Void::Type Throw(E const & e)
        {
            throw e;
        }

        class Type
        {
        protected:
            ::Wiz::Char::ConstPtr  m_ReasonPtr;
        public:
            Type() : m_ReasonPtr(WIZ_NULLPTR)
            {
            }
            Type(::Wiz::Char::FixedConstPtr Msg) : m_ReasonPtr(Msg)
            {
            }
        public:
            virtual ::Wiz::Char::FixedConstPtr Reason() const
            {
                return this->m_ReasonPtr;
            }
        };

        ////////////////////////////////////////////////////////////////////////
        class BadAlloc : public ::Wiz::Exception::Type
        {
            typedef ::Wiz::Exception::Type  tSuper;
        public:
            BadAlloc() : tSuper("Bad Allocate")
            {}
        public:
        };

        // CLASS runtime_error
        class RunTimeError : public ::Wiz::Exception::Type
        {
            typedef ::Wiz::Exception::Type  tSuper;
        public:
            RunTimeError(::Wiz::String::In Msg) : m_Msg(Msg)
            {
                m_ReasonPtr = m_Msg.GetCStr();
            }
        private:
            ::Wiz::String::Type m_Msg;
        };
        ////////////////////////////////////////////////////////////////////////
    } /// end of namespace Exception
} /// end of namespace Wiz

#endif /*__WIZ_BASE_EXCEPTION_HPP__SHANHAOBO_19800429__*/
